<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>树莓派配置内网穿透 | 小黑博客</title><meta name="keywords" content="树莓派,linux"><meta name="author" content="BluesYoung-web"><meta name="copyright" content="BluesYoung-web"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="树莓派配置内网穿透账号准备 先去免费的内网穿透网站注册 每日签到可以获取免费流量 点击左侧导航栏去创建隧道(一般使用 TCP 隧道，配置对应的本地端口及远程端口即可)  软件准备12# 运行自动安装脚本，直接安装并注册系统服务bash &lt;(curl -s https:&#x2F;&#x2F;getfrp.sh)  1234567891011121314151617181920212223242526272829">
<meta property="og:type" content="article">
<meta property="og:title" content="树莓派配置内网穿透">
<meta property="og:url" content="https://bluesyoung-web.gitee.io/blog/2021-08-01-%E6%A0%91%E8%8E%93%E6%B4%BE%E9%85%8D%E7%BD%AE%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F.html">
<meta property="og:site_name" content="小黑博客">
<meta property="og:description" content="树莓派配置内网穿透账号准备 先去免费的内网穿透网站注册 每日签到可以获取免费流量 点击左侧导航栏去创建隧道(一般使用 TCP 隧道，配置对应的本地端口及远程端口即可)  软件准备12# 运行自动安装脚本，直接安装并注册系统服务bash &lt;(curl -s https:&#x2F;&#x2F;getfrp.sh)  1234567891011121314151617181920212223242526272829">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://bluesyoung-web.gitee.io/blog/img/shumeipai_cover.jpg">
<meta property="article:published_time" content="2021-08-01T07:12:05.000Z">
<meta property="article:modified_time" content="2021-08-01T07:34:13.482Z">
<meta property="article:author" content="BluesYoung-web">
<meta property="article:tag" content="树莓派">
<meta property="article:tag" content="linux">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://bluesyoung-web.gitee.io/blog/img/shumeipai_cover.jpg"><link rel="shortcut icon" href="/blog/img/favicon.png"><link rel="canonical" href="https://bluesyoung-web.gitee.io/blog/2021-08-01-%E6%A0%91%E8%8E%93%E6%B4%BE%E9%85%8D%E7%BD%AE%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="stylesheet" href="/blog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/blog/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: BluesYoung-web","link":"链接: ","source":"来源: 小黑博客","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"top-right"},
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '树莓派配置内网穿透',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2021-08-01 15:34:13'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/blog/css/background.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/HexoStaticFile@latest/Hexo/css/custom.min.css"></link><meta name="generator" content="Hexo 5.4.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/blog/img/lufei_siwangningshi.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">153</div></a></div><div class="data-item"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">54</div></a></div><div class="data-item"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">48</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/blog/img/shumeipai.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/blog/">小黑博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/blog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于我</span></a></div><div class="menus_item"><a class="site-page" href="/blog/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/blog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/blog/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/blog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">树莓派配置内网穿透</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-08-01T07:12:05.000Z" title="发表于 2021-08-01 15:12:05">2021-08-01</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-01T07:34:13.482Z" title="更新于 2021-08-01 15:34:13">2021-08-01</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/blog/categories/%E6%A0%91%E8%8E%93%E6%B4%BE/">树莓派</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>10分钟</span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="树莓派配置内网穿透"><a href="#树莓派配置内网穿透" class="headerlink" title="树莓派配置内网穿透"></a>树莓派配置内网穿透</h2><h3 id="账号准备"><a href="#账号准备" class="headerlink" title="账号准备"></a>账号准备</h3><ol>
<li>先去免费的内网穿透网站<a target="_blank" rel="noopener" href="https://www.natfrp.com/user/">注册</a></li>
<li>每日签到可以获取免费流量</li>
<li>点击左侧导航栏去创建隧道(一般使用 TCP 隧道，配置对应的本地端口及远程端口即可)</li>
</ol>
<h3 id="软件准备"><a href="#软件准备" class="headerlink" title="软件准备"></a>软件准备</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 运行自动安装脚本，直接安装并注册系统服务</span></span><br><span class="line">bash &lt;(curl -s https://getfrp.sh)</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 脚本实际内容如下：</span></span><br><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ <span class="string">&quot;<span class="subst">$(uname -s)</span>&quot;</span> =~ <span class="string">&quot;Darwin&quot;</span> ]]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line">    red=<span class="string">&#x27;&#x27;</span></span><br><span class="line">    green=<span class="string">&#x27;&#x27;</span></span><br><span class="line">    yellow=<span class="string">&#x27;&#x27;</span></span><br><span class="line">    magenta=<span class="string">&#x27;&#x27;</span></span><br><span class="line">    cyan=<span class="string">&#x27;&#x27;</span></span><br><span class="line">    none=<span class="string">&#x27;&#x27;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">    red=<span class="string">&#x27;\e[91m&#x27;</span></span><br><span class="line">    green=<span class="string">&#x27;\e[92m&#x27;</span></span><br><span class="line">    yellow=<span class="string">&#x27;\e[93m&#x27;</span></span><br><span class="line">    magenta=<span class="string">&#x27;\e[95m&#x27;</span></span><br><span class="line">    cyan=<span class="string">&#x27;\e[96m&#x27;</span></span><br><span class="line">    none=<span class="string">&#x27;\e[0m&#x27;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line">WORK_PATH=$(dirname $(readlink -f <span class="variable">$0</span>))</span><br><span class="line"></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"><span class="comment">## 第一阶段     确认运行</span></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## 起始提示</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;<span class="variable">$&#123;green&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;----------------------------------------------------&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot; ____        _                      _____&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;/ ___|  __ _| | ___   _ _ __ __ _  |  ___| __ _ __&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;\___ \ / _\` | |/ / | | | &#x27;__/ _\` | | |_ | &#x27;__| &#x27;_ \\&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot; ___) | (_| |   &lt;| |_| | | | (_| | |  _|| |  | |_) |&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|____/ \__,_|_|\_\\\\___,_|_|  \__,_| |_|  |_|  | .__/&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;                                             |_|&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;----------------------------------------------------&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;提示:&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  1. 如需退出脚本, 请按下 <span class="variable">$&#123;magenta&#125;</span>Ctrl-C<span class="variable">$&#123;none&#125;</span> 组合键退出.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  2. 在 Linux Shell 中, 复制并不是使用 <span class="variable">$&#123;magenta&#125;</span>Ctrl-C<span class="variable">$&#123;none&#125;</span> 组合键, 请自行寻找你所使用的的终端程序的复制按钮.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  3. 如果你的系统没有安装 curl , 请先安装 curl .&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;      Ubuntu/Debian 安装 curl 命令: <span class="variable">$&#123;magenta&#125;</span>apt-get install -y curl<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;      CentOS 安装 curl 命令:        <span class="variable">$&#123;magenta&#125;</span>yum install -y curl<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  4. 安装前请检查网络连接以及系统权限.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  5. 隧道 ID 可在 <span class="variable">$&#123;yellow&#125;</span>https://www.natfrp.com/tunnel/<span class="variable">$&#123;none&#125;</span> 处获得.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  6. 访问密钥可在 <span class="variable">$&#123;yellow&#125;</span>https://www.natfrp.com/user/profile/<span class="variable">$&#123;none&#125;</span> 处获得.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;  7. 本脚本已经适配 macOS 系统.&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;继续运行请按 <span class="variable">$&#123;yellow&#125;</span>Enter<span class="variable">$&#123;none&#125;</span> 键, 退出请按 <span class="variable">$&#123;magenta&#125;</span>Ctrl-C<span class="variable">$&#123;none&#125;</span> 键.&quot;</span>)</span>&quot;</span> go</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"><span class="comment">## 第二阶段     检测</span></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"></span><br><span class="line">clear &amp;&amp; clear                                                                  <span class="comment"># 清屏</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;正在检测运行环境...&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 判断权限</span></span><br><span class="line"><span class="comment"># [[ $(id -u) != 0 ]] &amp;&amp; echo -e &quot;\n 请使用 $&#123;red&#125;root$&#123;none&#125; 用户运行此脚本! \n 示例: $&#123;magenta&#125;sudo bash \&quot;$&#123;0&#125;\&quot;$&#123;none&#125;&quot; &amp;&amp; exit -1</span></span><br><span class="line"></span><br><span class="line">FRP_OS_DETECT=<span class="string">&quot;<span class="subst">$(uname -m)</span>&quot;</span>                                                     <span class="comment"># 检测硬件架构</span></span><br><span class="line">FRP_OS_L_D=<span class="string">&quot;<span class="subst">$(uname -s)</span>&quot;</span>                                                        <span class="comment"># 检测系统类型 [Linux, macOS]</span></span><br><span class="line"><span class="comment"># FRP_OS_B=&quot;$(lsb_release -d -s)&quot;                                               # 注: 本命令在某些系统上不可用</span></span><br><span class="line"></span><br><span class="line">[[ <span class="string">&quot;<span class="variable">$&#123;FRP_OS_DETECT&#125;</span>&quot;</span> =~ <span class="string">&quot;arm&quot;</span>    ]] &amp;&amp; FRP_OS_DETECT=<span class="string">&quot;arm&quot;</span>                     <span class="comment"># 判断架构是否包含 arm</span></span><br><span class="line">[[ <span class="string">&quot;<span class="variable">$&#123;FRP_OS_L_D&#125;</span>&quot;</span>    =~ <span class="string">&quot;Darwin&quot;</span> ]] &amp;&amp; FRP_OS=<span class="string">&quot;darwin&quot;</span>     || FRP_OS=<span class="string">&quot;linux&quot;</span>   <span class="comment"># 判断系统是否为 macOS</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## 输出提示</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 当前系统类型是: <span class="variable">$&#123;yellow&#125;</span><span class="variable">$&#123;FRP_OS&#125;</span><span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 系统硬件架构是: <span class="variable">$&#123;yellow&#125;</span><span class="variable">$&#123;FRP_OS_DETECT&#125;</span><span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"><span class="comment"># echo -e &quot;|- 你的系统版本是: $&#123;yellow&#125;$&#123;FRP_OS_B&#125;$&#123;none&#125;&quot;                       # 注: 本命令对应的指令在某些系统上不可用</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 当前系统时间是: <span class="variable">$&#123;yellow&#125;</span><span class="subst">$(date +<span class="string">&quot;%Y 年 %m 月 %d 日   %H 时 %M 分&quot;</span>)</span><span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">case</span> <span class="string">&quot;<span class="variable">$&#123;FRP_OS_DETECT&#125;</span>&quot;</span> <span class="keyword">in</span></span><br><span class="line"><span class="string">&quot;i386&quot;</span>)     FRP_ARCH=<span class="string">&quot;386&quot;</span>      ;;     <span class="comment"># [ x86  架构 ] 32 位系统  (i386)</span></span><br><span class="line"><span class="string">&quot;x86_64&quot;</span>)   FRP_ARCH=<span class="string">&quot;amd64&quot;</span>    ;;     <span class="comment"># [ x86  架构 ] 64 位系统  (x86_64)</span></span><br><span class="line"><span class="string">&quot;arm&quot;</span>)      FRP_ARCH=<span class="string">&quot;arm&quot;</span>      ;;     <span class="comment"># [ arm  架构 ] arm</span></span><br><span class="line"><span class="string">&quot;arm64&quot;</span>)    FRP_ARCH=<span class="string">&quot;arm64&quot;</span>    ;;     <span class="comment"># [ arm  架构 ] arm64</span></span><br><span class="line"><span class="string">&quot;aarch&quot;</span>)    FRP_ARCH=<span class="string">&quot;arm&quot;</span>      ;;     <span class="comment"># [ arm  架构 ] armv8     (aarch)</span></span><br><span class="line"><span class="string">&quot;aarch64&quot;</span>)  FRP_ARCH=<span class="string">&quot;arm64&quot;</span>    ;;     <span class="comment"># [ arm  架构 ] armv8 x64 (aarch64)</span></span><br><span class="line"><span class="string">&quot;mips&quot;</span>)     FRP_ARCH=<span class="string">&quot;mips&quot;</span>     ;;     <span class="comment"># [ mips 架构 ] mips</span></span><br><span class="line"><span class="string">&quot;mips64&quot;</span>)   FRP_ARCH=<span class="string">&quot;mips64&quot;</span>   ;;     <span class="comment"># [ mips 架构 ] mips64</span></span><br><span class="line"><span class="string">&quot;mipsle&quot;</span>)   FRP_ARCH=<span class="string">&quot;mipsle&quot;</span>   ;;     <span class="comment"># [ mips 架构 ] mipsle</span></span><br><span class="line"><span class="string">&quot;mips64le&quot;</span>) FRP_ARCH=<span class="string">&quot;mips64le&quot;</span> ;;     <span class="comment"># [ mips 架构 ] mips64le</span></span><br><span class="line">*)</span><br><span class="line">    <span class="comment">## 抛出异常&amp;输出帮助讯息</span></span><br><span class="line">    clear</span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;\n\e[41;30m                    ERROR                    \033[0m&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;<span class="variable">$&#123;red&#125;</span>我们无法自动下载适合你所用的系统的客户端.<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;              可用的客户端程序列表&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;\033[45;37m ID     系统     架构             文件名          \033[0m&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[01]  Windows    i386       <span class="variable">$&#123;cyan&#125;</span>frpc_windows_386.exe<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[02]  Windows    amd64      <span class="variable">$&#123;cyan&#125;</span>frpc_windows_amd64.exe<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[03]   Linux     i386       <span class="variable">$&#123;cyan&#125;</span>frpc_linux_386<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[04]   Linux     amd64      <span class="variable">$&#123;cyan&#125;</span>frpc_linux_amd64<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[05]   Linux     arm        <span class="variable">$&#123;cyan&#125;</span>frpc_linux_arm<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[06]   Linux     arm64      <span class="variable">$&#123;cyan&#125;</span>frpc_linux_arm64<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[07]   Linux     Mips       <span class="variable">$&#123;cyan&#125;</span>frpc_linux_mips<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[08]   Linux     Mips64     <span class="variable">$&#123;cyan&#125;</span>frpc_linux_mips64<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[09]   Linux     Mipsle     <span class="variable">$&#123;cyan&#125;</span>frpc_linux_mipsle<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[10]   Linux     Mips64le   <span class="variable">$&#123;cyan&#125;</span>frpc_linux_mips64le<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[11]  FreeBSD    i386       <span class="variable">$&#123;cyan&#125;</span>frpc_freebsd_386<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[12]  FreeBSD    amd64      <span class="variable">$&#123;cyan&#125;</span>frpc_freebsd_amd64<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;[13]   MacOS     amd64      <span class="variable">$&#123;cyan&#125;</span>frpc_darwin_amd64<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;如果你的硬件架构在上方列表之中, 请前往 <span class="variable">$&#123;yellow&#125;</span>https://www.natfrp.com/tunnel/download/<span class="variable">$&#123;none&#125;</span> 下载适合的客户端. &quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;如果条件允许, 也可将下方给出的错误提示上报给网站管理员或脚本作者 [宝硕(<span class="variable">$&#123;yellow&#125;</span>i@baoshuo.ren<span class="variable">$&#123;none&#125;</span>), fengberd(<span class="variable">$&#123;yellow&#125;</span>berd@rbq.email<span class="variable">$&#123;none&#125;</span>)].&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;下载完成后请使用 <span class="variable">$&#123;magenta&#125;</span>chmod +x 文件名<span class="variable">$&#123;none&#125;</span> 命令给予运行权限.&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;请按 <span class="variable">$&#123;yellow&#125;</span>Enter<span class="variable">$&#123;none&#125;</span> 键继续显示下一页(调试信息)...&quot;</span>)</span>&quot;</span> go</span><br><span class="line">    clear &amp;&amp; clear</span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;\n\e[41;93m          [调试用]系统信息          \e[0m\n&quot;</span></span><br><span class="line">    cat /etc/os-release</span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    uname -a</span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;\n当前时间: <span class="variable">$&#123;yellow&#125;</span><span class="subst">$(date +<span class="string">&quot;%Y 年 %m 月 %d 日   %H 时 %M 分&quot;</span>)</span><span class="variable">$&#123;none&#125;</span>\n\n正在退出...\n&quot;</span></span><br><span class="line">    <span class="built_in">exit</span> -1</span><br><span class="line">    ;;</span><br><span class="line"><span class="keyword">esac</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">## 脚本异常退出提示</span></span><br><span class="line"><span class="function"><span class="title">abort</span></span>()&#123;</span><br><span class="line">    <span class="built_in">echo</span> -e &gt;&amp;2 <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e &gt;&amp;2 <span class="string">&quot;********************&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e &gt;&amp;2 <span class="string">&quot;*** <span class="variable">$&#123;red&#125;</span>脚本执行中断<span class="variable">$&#123;none&#125;</span> ***&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e &gt;&amp;2 <span class="string">&quot;********************&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e &gt;&amp;2 <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;请按 <span class="variable">$&#123;yellow&#125;</span>Enter<span class="variable">$&#123;none&#125;</span> 键退出...&quot;</span>)</span>&quot;</span> go</span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;\n当前时间: <span class="variable">$&#123;yellow&#125;</span><span class="subst">$(date +<span class="string">&quot;%Y 年 %m 月 %d 日   %H 时 %M 分&quot;</span>)</span><span class="variable">$&#123;none&#125;</span>\n正在退出...\n&quot;</span></span><br><span class="line">    <span class="built_in">exit</span> -1</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="built_in">trap</span> <span class="string">&#x27;abort&#x27;</span> 0</span><br><span class="line"><span class="built_in">set</span> -e</span><br><span class="line"></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"><span class="comment">## 第三阶段     下载 &amp; 权限处理</span></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 创建文件夹</span></span><br><span class="line">FRP_EXEC_DIR=<span class="string">&quot;/usr/local/frp/&quot;</span></span><br><span class="line">mkdir -p <span class="variable">$&#123;FRP_EXEC_DIR&#125;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成文件名</span></span><br><span class="line">FRP_EXEC=<span class="string">&quot;frpc_<span class="variable">$&#123;FRP_OS&#125;</span>_<span class="variable">$&#123;FRP_ARCH&#125;</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 下载客户端</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 下载客户端...\c&quot;</span></span><br><span class="line">curl -sSLO <span class="string">&quot;https://getfrp.sh/d/<span class="variable">$&#123;FRP_EXEC&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;      <span class="variable">$&#123;green&#125;</span>成功!<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 移动客户端</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 移动客户端...\c&quot;</span></span><br><span class="line">mv <span class="string">&quot;./<span class="variable">$&#123;FRP_EXEC&#125;</span>&quot;</span> <span class="string">&quot;<span class="variable">$&#123;FRP_EXEC_DIR&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;      <span class="variable">$&#123;green&#125;</span>成功!<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;|- 权限处理...\c&quot;</span></span><br><span class="line">chmod +x <span class="string">&quot;<span class="variable">$&#123;FRP_EXEC_DIR&#125;</span><span class="variable">$&#123;FRP_EXEC&#125;</span>&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;        <span class="variable">$&#123;green&#125;</span>成功!<span class="variable">$&#123;none&#125;</span>&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">trap</span> : 0</span><br><span class="line"></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"><span class="comment">## 第四阶段     命令生成</span></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"><span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;请输入你的<span class="variable">$&#123;yellow&#125;</span>访问密钥<span class="variable">$&#123;none&#125;</span>: &quot;</span>)</span>&quot;</span> FRP_KEY</span><br><span class="line"><span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;请输入你的<span class="variable">$&#123;yellow&#125;</span>隧道 ID<span class="variable">$&#123;none&#125;</span> : &quot;</span>)</span>&quot;</span> FRP_TID</span><br><span class="line"><span class="keyword">if</span> [[ <span class="string">&quot;<span class="variable">$&#123;FRP_OS&#125;</span>&quot;</span> == <span class="string">&quot;darwin&quot;</span> ]]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line">FRP_SERVICE=<span class="string">&quot;n&quot;</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="built_in">read</span> -p <span class="string">&quot;<span class="subst">$(echo -e <span class="string">&quot;是否安装为系统服务?(y/N) : &quot;</span>)</span>&quot;</span>          FRP_SERVICE</span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ <span class="string">&quot;<span class="variable">$&#123;FRP_SERVICE&#125;</span>&quot;</span> == <span class="string">&quot;y&quot;</span> || <span class="string">&quot;<span class="variable">$&#123;FRP_SERVICE&#125;</span>&quot;</span> == <span class="string">&quot;Y&quot;</span> ]]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;即将安装为系统服务...&quot;</span></span><br><span class="line">    clear &amp;&amp; clear</span><br><span class="line"><span class="keyword">else</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line">    <span class="built_in">echo</span> -e <span class="string">&quot;请使用 <span class="variable">$&#123;magenta&#125;</span><span class="variable">$&#123;FRP_EXEC_DIR&#125;</span><span class="variable">$&#123;FRP_EXEC&#125;</span> -f <span class="variable">$&#123;FRP_KEY&#125;</span>:<span class="variable">$&#123;FRP_TID&#125;</span><span class="variable">$&#123;none&#125;</span> 命令来启动隧道.&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"><span class="comment">## 第五阶段     安装服务</span></span><br><span class="line"><span class="comment">## ----------------------------------------</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> [[ <span class="string">&quot;<span class="variable">$&#123;FRP_SERVICE&#125;</span>&quot;</span> == <span class="string">&quot;y&quot;</span> || <span class="string">&quot;<span class="variable">$&#123;FRP_SERVICE&#125;</span>&quot;</span> == <span class="string">&quot;Y&quot;</span> ]]</span><br><span class="line"><span class="keyword">then</span></span><br><span class="line">    <span class="comment"># 写配置文件</span></span><br><span class="line">    <span class="built_in">echo</span> <span class="string">&quot;[Unit]</span></span><br><span class="line"><span class="string">Description=Sakura Frp Client Service</span></span><br><span class="line"><span class="string">After=network.target syslog.target</span></span><br><span class="line"><span class="string">Wants=network.target</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">[Service]</span></span><br><span class="line"><span class="string">Type=simple</span></span><br><span class="line"><span class="string">Restart=on-failure</span></span><br><span class="line"><span class="string">RestartSec=5s</span></span><br><span class="line"><span class="string">ExecStart=<span class="variable">$&#123;FRP_EXEC_DIR&#125;</span><span class="variable">$&#123;FRP_EXEC&#125;</span> -f <span class="variable">$&#123;FRP_KEY&#125;</span>:<span class="variable">$&#123;FRP_TID&#125;</span></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">[Install]</span></span><br><span class="line"><span class="string">WantedBy=multi-user.target</span></span><br><span class="line"><span class="string">&quot;</span> &gt; /lib/systemd/system/frpc.service</span><br><span class="line"></span><br><span class="line">systemctl daemon-reload</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 启动 frpc 服务</span></span><br><span class="line">    systemctl <span class="built_in">enable</span> frpc</span><br><span class="line">    systemctl start  frpc</span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;使用 <span class="variable">$&#123;magenta&#125;</span>systemctl stop frpc &amp;&amp; systemctl disable frpc<span class="variable">$&#123;none&#125;</span> 命令停止服务&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;使用 <span class="variable">$&#123;magenta&#125;</span>systemctl status frpc<span class="variable">$&#123;none&#125;</span> 命令查看服务状态和 frpc 日志&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;使用 <span class="variable">$&#123;magenta&#125;</span>rm -f /lib/systemd/system/frpc.service<span class="variable">$&#123;none&#125;</span> 命令<span class="variable">$&#123;red&#125;</span>删除<span class="variable">$&#123;none&#125;</span>服务配置&quot;</span></span><br><span class="line"><span class="keyword">fi</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;脚本作者: 宝硕(https://baoshuo.ren), FENGberd(https://berd.moe).&quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;感谢热心网友提供测试支持! &quot;</span></span><br><span class="line"><span class="built_in">echo</span> -e <span class="string">&quot;&quot;</span></span><br></pre></td></tr></table></figure>

<h3 id="启用隧道"><a href="#启用隧道" class="headerlink" title="启用隧道"></a>启用隧道</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl start frpc@我是从网站获取的秘钥:我是隧道列表看到的隧道id</span><br></pre></td></tr></table></figure>

<h3 id="注意"><a href="#注意" class="headerlink" title="注意"></a>注意</h3><ul>
<li><strong>绝对不要重复开启隧道</strong></li>
<li>可以使用 <code>systemctl list-units frpc@*</code> 查看已开启的隧道</li>
</ul>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">BluesYoung-web</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://bluesyoung-web.gitee.io/blog/2021-08-01-%E6%A0%91%E8%8E%93%E6%B4%BE%E9%85%8D%E7%BD%AE%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F.html">https://bluesyoung-web.gitee.io/blog/2021-08-01-%E6%A0%91%E8%8E%93%E6%B4%BE%E9%85%8D%E7%BD%AE%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://BluesYoung-web.gitee.io/blog" target="_blank">小黑博客</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/blog/tags/%E6%A0%91%E8%8E%93%E6%B4%BE/">树莓派</a><a class="post-meta__tags" href="/blog/tags/linux/">linux</a></div><div class="post_share"></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/blog/img/wx.png" target="_blank"><img class="post-qr-code-img" src="/blog/img/wx.png" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/blog/img/zfb.jpg" target="_blank"><img class="post-qr-code-img" src="/blog/img/zfb.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/blog/2021-07-28-Linux使用跳板机登录对应的服务器.html" title="Linux使用跳板机登录对应的服务器"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-07-28</div><div class="title">Linux使用跳板机登录对应的服务器</div></div></a></div><div><a href="/blog/2021-08-11-Linux启用SSH服务.html" title="Linux启用SSH服务"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-08-11</div><div class="title">Linux启用SSH服务</div></div></a></div><div><a href="/blog/2021-08-16-Linux安装you-get.html" title="Linux安装you-get"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-08-16</div><div class="title">Linux安装you-get</div></div></a></div><div><a href="/blog/2021-06-12-Linux常用操作01.html" title="Linux常用操作01"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-06-12</div><div class="title">Linux常用操作01</div></div></a></div><div><a href="/blog/2021-05-16-Linux开机自启与内存管理.html" title="Linux开机自启与内存管理"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-05-16</div><div class="title">Linux开机自启与内存管理</div></div></a></div><div><a href="/blog/2021-04-10-树莓派使用Samba.html" title="树莓派使用Samba"><img class="cover" src="/blog/img/shumeipai_cover.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-04-10</div><div class="title">树莓派使用Samba</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/blog/img/lufei_siwangningshi.jpg" onerror="this.onerror=null;this.src='/blog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">BluesYoung-web</div><div class="author-info__description">一枚不善言辞的技术宅</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/blog/archives/"><div class="headline">文章</div><div class="length-num">153</div></a></div><div class="card-info-data-item"><a href="/blog/tags/"><div class="headline">标签</div><div class="length-num">54</div></a></div><div class="card-info-data-item"><a href="/blog/categories/"><div class="headline">分类</div><div class="length-num">48</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/BluesYoung-web"><i class="fab fa-gitee"></i><span>点个小星星吧</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/BluesYoung-web" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:15171255945@163.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/2021-08-24-%E7%A7%BB%E5%8A%A8%E7%AB%AF%E8%BD%AF%E9%94%AE%E7%9B%98%E5%AF%BC%E8%87%B4%E5%B8%83%E5%B1%80%E9%94%99%E4%B9%B1.html" title="移动端软键盘导致布局错乱"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="移动端软键盘导致布局错乱"/></a><div class="content"><a class="title" href="/blog/2021-08-24-%E7%A7%BB%E5%8A%A8%E7%AB%AF%E8%BD%AF%E9%94%AE%E7%9B%98%E5%AF%BC%E8%87%B4%E5%B8%83%E5%B1%80%E9%94%99%E4%B9%B1.html" title="移动端软键盘导致布局错乱">移动端软键盘导致布局错乱</a><time datetime="2021-08-24T10:01:20.000Z" title="发表于 2021-08-24 18:01:20">2021-08-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2021-08-16-Linux%E5%AE%89%E8%A3%85you-get.html" title="Linux安装you-get"><img src="/blog/img/shumeipai_cover.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Linux安装you-get"/></a><div class="content"><a class="title" href="/blog/2021-08-16-Linux%E5%AE%89%E8%A3%85you-get.html" title="Linux安装you-get">Linux安装you-get</a><time datetime="2021-08-16T08:07:31.000Z" title="发表于 2021-08-16 16:07:31">2021-08-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2021-08-16-git%E5%88%A0%E9%99%A4%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E6%8F%90%E4%BA%A4.html" title="git删除远程仓库的提交"><img src="/blog/img/skill.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="git删除远程仓库的提交"/></a><div class="content"><a class="title" href="/blog/2021-08-16-git%E5%88%A0%E9%99%A4%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%E7%9A%84%E6%8F%90%E4%BA%A4.html" title="git删除远程仓库的提交">git删除远程仓库的提交</a><time datetime="2021-08-16T07:52:02.000Z" title="发表于 2021-08-16 15:52:02">2021-08-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2021-08-13-%E5%B0%86pad%E6%89%A9%E5%B1%95%E4%B8%BA%E7%94%B5%E8%84%91%E7%9A%84%E5%89%AF%E5%B1%8F.html" title="将pad扩展为电脑的副屏"><img src="/blog/img/skill.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="将pad扩展为电脑的副屏"/></a><div class="content"><a class="title" href="/blog/2021-08-13-%E5%B0%86pad%E6%89%A9%E5%B1%95%E4%B8%BA%E7%94%B5%E8%84%91%E7%9A%84%E5%89%AF%E5%B1%8F.html" title="将pad扩展为电脑的副屏">将pad扩展为电脑的副屏</a><time datetime="2021-08-13T11:44:04.000Z" title="发表于 2021-08-13 19:44:04">2021-08-13</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/2021-08-11-Linux%E5%90%AF%E7%94%A8SSH%E6%9C%8D%E5%8A%A1.html" title="Linux启用SSH服务"><img src="/blog/img/shumeipai_cover.jpg" onerror="this.onerror=null;this.src='/blog/img/404.jpg'" alt="Linux启用SSH服务"/></a><div class="content"><a class="title" href="/blog/2021-08-11-Linux%E5%90%AF%E7%94%A8SSH%E6%9C%8D%E5%8A%A1.html" title="Linux启用SSH服务">Linux启用SSH服务</a><time datetime="2021-08-11T10:50:04.000Z" title="发表于 2021-08-11 18:50:04">2021-08-11</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By BluesYoung-web</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/blog/js/utils.js"></script><script src="/blog/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/blog/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>if (document.getElementsByClassName('mermaid').length) {
  if (window.mermaidJsLoad) mermaid.init()
  else {
    getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(() => {
      window.mermaidJsLoad = true
      mermaid.initialize({
        theme: 'default',
      })
      false && mermaid.init()
    })
  }
}</script></div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script> <script src="/blog/js/xkTool.js"></script> <script src="/blog/js/mySelf.js"></script><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js"></script></div></body></html>